﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ContactManager.Common;

namespace ContactManager
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                int uNum = AccessHelper.ExecuteScalar("select count(*) from users");

                if (uNum > 0)
                {
                    LoginFrm lg = new LoginFrm();
                    lg.ShowDialog();
                    if (lg.DialogResult == DialogResult.OK)
                    {
                        Application.Run(new HomeFrm());
                    }
                }
                else
                {
                    Application.Run(new HomeFrm());
                }
                
           
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
    }
}
